﻿using System;
using System.Collections.Generic;

using System.Text;

namespace AuroraLightsFX
{
    public class USBaccess
    {
        // Fields
        public byte[] buf;
        private const byte GET_DATA_COMMAND_ID = 0x11;
        private const byte GET_STATUS_COMMAND_ID = 6;
        public int pid;
        public bool status;
        public int vid;

        // Methods
        public void GetData()
        {
            this.PollInput(0x11);
        }

        public void GetStatus()
        {
            this.PollInput(6);
        }

        private void PollInput(byte dataID)
        {
            LEDcontrol dcontrol = new LEDcontrol();
            this.buf = new byte[9];
            this.vid = dcontrol.VendorId;
            this.pid = dcontrol.ProductId;
            this.status = dcontrol.ReadUSBData(dataID, out this.buf);
            dcontrol.CloseDevice();
        }
    }

}
